The preceding code is an example of the process of converting a
byte into a string.
2.5.10.1.6 Enum
Enum represents a fixed number of predefined constant values, and
has one as the default. Enums are greatly helpful when we need to
have a set of fixed and related data, for example, the days of a week
or months in a year or holidays in a year etc. The following is an
example, i.e., FirstEnumContract.sol:
// SPDX-License-Identifier: Some Identifier
pragma solidity ^0.8.10;
contract FirstEnumContract {
enum SomeData {DEFAULT,ONE,TWO}
SomeData someData;
function FirstEnum() public{
someData = SomeData.DEFAULT;
}
function setValues(uint value) public {
require(uint(SomeData.TWO) >= value);
someData = SomeData(value);
}
function getValue() public view returns (uint){
return uint(someData);
}
}
2.5.10.1.7 Address
Address is a type that saves an account address on the Ethereum
node. Addresses can be very useful if we have to transfer the Ethers
as payments from one Ethereum account to another. Using the
address’s balance and transfer functions, we can copy the amount
from one to another address on the Ethereum nodes. Addresses can
be of the following two types: